package com.qijian.tool.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qijian.tool.domain.Storage;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 本地存储Service接口
 *
 * @author qijian
 * @date 2021-09-06
 */
public interface IStorageService extends IService<Storage> {

    List<Long> filterFids(String classTable, List<Long> ids);

    List<Storage> listByClassId(Long classId);

    List<Storage> listByIds(Set<Long> ids);


    List<Storage> listByClassId(Long classId, String classTable);

    Map<Long, List<Storage>> mapByClassIds(Collection<Long> classIds, String classTable);

    Map<Long, List<Storage>> mapByClassIds(Collection<Long> classIds);

    Boolean importCadZip(MultipartFile file);

    void zip(HttpServletResponse response, List<String> urls);

    void zip(HttpServletResponse response, List<String> urls,String fileName);

    void initFileClass(Long classId, String classType, List<Storage> files);

    void copyFileClass(Long classId, String classType, List<Long> storageIds);

    void copyFileClass(Long classId, String classType, Integer classify, List<Long> storageIds);

    Boolean remove(List<Long> ids, List<Long> excludeIds);

    Storage importFileByByte(byte[] bytes, String folder, Storage storage) throws IOException;

    List<Long> storageIdToFilter(String classTable, Collection<Long> classIds);

    Storage addStoreData(String classTable, Long classId, Integer classify, String description, MultipartFile file, String folder, String suffix);

    boolean removeAndFileByIds(List<Long> storageIds);

    /**
     * 删除数据存储带模块
     * @param storageIds
     * @param module
     * @return
     */
    boolean removeAndFileWithModule(List<Long> storageIds,String module);

    boolean removeAndFileByClassIds(List<Long> classIds);

    void zipWithSubFolder(HttpServletResponse response, Map<String,List<String>> folderMap);

    void zipByProjectIds(HttpServletResponse response, List<Long> projectIds);

    Storage addStoreDataWithWatermark(String classTable, Long classId, Integer classify, String description, MultipartFile file, String folder, String suffix);
}
